import { Component } from "./enums";
import { Feild, SelectItem, InputElement, InputNumberElement, TextareaElement, SelectElement, TreeSelectElement, DatePickerElement, BaseComponent, SelectEvents } from "./types";

export interface Input extends BaseComponent {
    type: Component.Input
    element?: InputElement
}

export interface InputNumber extends Feild {
    type: Component.InputNumber
    element?: InputNumberElement
}

export interface Textarea extends Feild {
    type: Component.Textarea
    element?: TextareaElement
}

export interface Select extends Feild {
    type: Component.Select
    config: {
        list: SelectItem[]
    }
    element?: SelectElement
    events?: SelectEvents
}

export interface UrlSelect extends Feild {
    type: Component.UrlSelect
    config: {
        url: string,
        labelTarget: string
        valueTarget: string
        params?: any
        split?: string
    },
    element?: SelectElement
    events?: SelectEvents
}

export interface DictSelect extends Feild {
    type: Component.DictSelect
    config: {
        dict: string
    }
    events?: SelectEvents
}

export interface TreeSelect extends Feild {
    type: Component.TreeSelect
    config: {
        url: string
        labelTarget?: string
        valueTarget?: string
        convertData?: (data: any) => void
    },
    element?: TreeSelectElement
    events?: SelectEvents
}

export interface Radio extends Feild {
    type: Component.Radio
    config: {
        dict?: string
        list?: SelectItem[]
    }
}

export interface Checkbox extends Feild {
    type: Component.Checkbox
    config: {
        dict?: string
        list?: SelectItem[]
    }
}

export interface DatePicker extends Feild {
    type: Component.DatePicker
    element?: DatePickerElement
}

export interface Upload extends Feild {
    type: Component.Upload
    config: {
        url?: string
        maxSize?: number
        authorization?: string
        accept?: string
        acceptTip?: string
        headers?: any
        params?: () => any
    }
}

